<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>


  <div id="app">

    用户名 : <input type="text" @input="inp" v-model="username">
    
    重置: <button @click="resetUname"> 重置 用户名 </button>

  </div>

  <!-- v-model  双向数据绑定 -->
  <script src="./vue2.6.12.js"></script>

  <script>

    var app = new Vue({
      el:'#app',
      data:{
        username:''
      },
      methods:{
        inp(){
          console.log("username:",this.username);
        },
        resetUname(){
          this.username = ''
        }
      }
    })
    </script>
</body>
</html>